package mop.exception;

/**
 * Exception class to be thrown when an invalid status is set
 * 
 * @invar none this is a exception
 * 
 * @author	 MOP Team 7
 */
public class IllegalStatusException extends Throwable 
{

	/**
	 * Initializes an IllegalStatusException with given status
	 * 
	 * @param status
	 *  the name of the status that's causing the problem
	 *  
	 * @effect sets the status
	 */
	public IllegalStatusException(String status)
	{
		this.setStatus(status);
	}
	
	/**
	 * return a error message that can be used by the gui
	 * 
	 * @return an error message describing the incorrect status
	 */
	public String toString()
	{
		
		StringBuffer sb = new StringBuffer();
		sb.append("The following state can not be set ! :: ");
		sb.append(this.status);
		return sb.toString();
		
	}
	
	 /**
	  * set the status
	  * 
	  * @param status
	  *  the name of the status that's causing trouble
	  *  
	  * @post the status is set to the passed one
	  *  |this.status == status
	  */
	 private void setStatus(String status) 
	 {

		 this.status = status;
	 }
	
	/**
	 * weird java demand
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * the name of the status thats causing the problem
	 */
	private String status;
	
}
